/**
 * Created with  SublimeText
 * @Author:      Lyle
 * @DateTime:    2017-08-30 10:11:49
 * @Description: 
 */
import globalMixin from './globalMixin'

var userProfilePartMixin = {

    mixins: [globalMixin],

    methods: {

        //default
        /*userProfilePartMixin_detailData(userData) {

            let detailData = {
                livingWith: '',
                appearance: '',
                background: '',
                lifestyle: '',
            };

            detailData.appearance += this.userProfilePartMixin_height(userData);
            detailData.appearance += this.userProfilePartMixin_bodyType(userData);
            detailData.appearance += this.userProfilePartMixin_eyesColor(userData);
            detailData.appearance += this.userProfilePartMixin_hairColor(userData);

            detailData.background += this.userProfilePartMixin_ethnicity(userData);
            detailData.background += this.userProfilePartMixin_religion(userData);
            detailData.background += this.userProfilePartMixin_education(userData);
            detailData.background += this.userProfilePartMixin_language(userData);
            detailData.background += this.userProfilePartMixin_political(userData);

            detailData.lifestyle += this.userProfilePartMixin_occupation(userData);
            detailData.lifestyle += this.userProfilePartMixin_income(userData);
            detailData.lifestyle += this.userProfilePartMixin_drinking(userData);
            detailData.lifestyle += this.userProfilePartMixin_smoking(userData);
            detailData.lifestyle += this.userProfilePartMixin_haveChildren(userData);
            detailData.lifestyle += this.userProfilePartMixin_wantChildren(userData);
            detailData.lifestyle += this.userProfilePartMixin_havePets(userData);


            if (detailData.appearance.length > 3) {
                detailData.appearance = detailData.appearance.substring(0, detailData.appearance.length - 2);
            }
            if (detailData.background.length > 3) {
                detailData.background = detailData.background.substring(0, detailData.background.length - 2);
            }
            if (detailData.lifestyle.length > 3) {
                detailData.lifestyle = detailData.lifestyle.substring(0, detailData.lifestyle.length - 2);
            }

            return detailData;
        },*/

        userProfilePartMixin_fliterValue(value) {
            if (value == this.language.unify_pleaseAskMe) {
                value = '';
            }
            //language
            value = value.replace(this.language.unify_pleaseAskMe + ', ', '');
            value = value.replace(this.language.unify_other + ', ', '');
            return value;
        },

        //appearance start
        userProfilePartMixin_height(userData) {
            let value = '';
            if (parseInt(userData.detail.basics.height) != 0) {
                value = this.userProfilePartMixin_fliterValue(this.getSelectLable('ms_height', userData.detail.basics.height));
            }
            if (value) {
                value += ', ';
            }
            return value;
        },

        userProfilePartMixin_bodyType(userData) {
            let value = '';
            if (parseInt(userData.detail.basics.body_type) != 32) {
                let bodyTypeStr = this.userProfilePartMixin_fliterValue(this.getSelectLable('ms_body', userData.detail.basics.body_type));
                bodyTypeStr = bodyTypeStr == 'Average' ? this.language.myProfile_detailTipOne : bodyTypeStr
                value = bodyTypeStr;
            }
            if (value) {
                value += ', ';
            }
            return value;
        },

        userProfilePartMixin_eyesColor(userData) {
            let value = '';
            if (parseInt(userData.detail.basics.eyes_color) != 128 && parseInt(userData.detail.basics.eyes_color) != 64) {
                value = this.userProfilePartMixin_fliterValue(this.getSelectLable('ms_eyes', userData.detail.basics.eyes_color));
            }
            if (value) {
                value += ' ' + this.language.myProfile_eyes + ', ';
            }
            return value;
        },

        userProfilePartMixin_hairColor(userData) {
            let value = '';
            if (parseInt(userData.detail.basics.hair_color) != 256 && parseInt(userData.detail.basics.hair_color) != 4096) {
                value = this.userProfilePartMixin_fliterValue(this.getSelectLable('ms_hair', userData.detail.basics.hair_color));
            }
            if (value) {
                value += ' ' + this.language.myProfile_hair + ', ';
            }
            return value;
        },

        //appearance end

        //background star
        userProfilePartMixin_ethnicity(userData) {
            let value = '';
            if (parseInt(userData.detail.personalinfo.ethnicity) != 32 && parseInt(userData.detail.personalinfo.ethnicity) != 64) {
                value = this.userProfilePartMixin_fliterValue(this.getSelectLable('ms_ethnicity', userData.detail.personalinfo.ethnicity));
            }
            if (value) {
                value += ', ';
            }
            return value;
        },

        userProfilePartMixin_religion(userData) {
            let value = '';
            if (parseInt(userData.detail.personalinfo.religion) != 512 && parseInt(userData.detail.personalinfo.religion) != 16384) {
                value = this.userProfilePartMixin_fliterValue(this.getSelectLable('ms_religion', userData.detail.personalinfo.religion));
            }
            if (value) {
                value += ', ';
            }
            return value;
        },

        userProfilePartMixin_education(userData) {
            let value = '';
            if (parseInt(userData.detail.personalinfo.education) != 64 && parseInt(userData.detail.personalinfo.education) != 128) {
                value = this.userProfilePartMixin_fliterValue(this.getSelectLable('ms_education', userData.detail.personalinfo.education));
            }
            if (value) {
                value += ', ';
            }
            return value;
        },

        userProfilePartMixin_language(userData) {
            let value = '',
                languageArr = this.getMultipleSelectLable(JSON.parse(Unit.getLocalStorage('ms_language')), userData.detail.personalinfo.language, ', ').split(', '),
                languageStr = '';

            if (languageArr.length > 1) {
                for (let i = 0; i < (languageArr.length); i++) {
                    if (parseInt(i) == parseInt(languageArr.length - 1)) {
                        languageStr += this.language.myProfile_and + languageArr[i];
                    } else {
                        languageStr += languageArr[i] + ', ';
                    }
                }
            } else {
                languageStr = languageArr[0];
            }

            languageStr = this.userProfilePartMixin_fliterValue(languageStr);

            if (languageStr) {
                value += this.language.myProfile_speaks + languageStr + ', ';
            }

            return value;
        },

        userProfilePartMixin_political(userData) {
            let value = '';
            if (parseInt(userData.detail.personalinfo.political) != 0 && parseInt(userData.detail.personalinfo.political) != 32) {
                value = this.userProfilePartMixin_fliterValue(this.getSelectLable('ms_political_beliefs', userData.detail.personalinfo.political) + this.language.myProfile_politics);
            }
            if (value) {
                value += ', ';
            }
            return value;
        },

        //lifestyle  star
        userProfilePartMixin_occupation(userData) {
            let value = '';
            value = this.userProfilePartMixin_fliterValue(this.getSelectLable('ms_occupation', userData.detail.personalinfo.occupation));
            if (value) {
                value = value + ', ';
            }
            return value;
        },

        userProfilePartMixin_income(userData) {
            let value = '';
            value = this.userProfilePartMixin_fliterValue(this.getSelectLable('ms_type2', userData.detail.worth.income));
            if (value) {
                if (parseInt(userData.detail.worth.income) == 10 || parseInt(userData.detail.worth.income) == 11) {
                    value = ''
                } else {
                    value = this.language.myProfile_income + value + ', ';
                }
            }
            return value;
        },

        userProfilePartMixin_drinking(userData) {
            let value = '';
            value = this.userProfilePartMixin_fliterValue(this.getSelectLable('ms_drinker', userData.detail.lifestyle.drinking));
            if (value) {
                if (typeof(this.language['profile_drinking_' + userData.detail.lifestyle.drinking]) != 'undefined') {
                    value = this.language['profile_drinking_' + userData.detail.lifestyle.drinking];
                }
                value = value + ', ';
            }
            return value;
        },

        userProfilePartMixin_smoking(userData) {
            let value = '';
            value = this.userProfilePartMixin_fliterValue(this.getSelectLable('ms_smoker', userData.detail.lifestyle.smoking));
            if (value) {
                if (typeof(this.language['profile_smoking_' + userData.detail.lifestyle.smoking]) != 'undefined') {
                    value = this.language['profile_smoking_' + userData.detail.lifestyle.smoking];
                }
                if (value == 'Smoke socially') {
                    value = 'Smokes socially';
                } else if (value == 'Smoke regularly') {
                    value = 'Smokes regularly';
                }
                value = value + ', ';
            }
            return value;
        },

        userProfilePartMixin_haveChildren(userData) {
            let value = '';
            value = this.userProfilePartMixin_fliterValue(this.getSelectLable('ms_have_children', userData.detail.lifestyle.have_children));
            if (value) {
                if (typeof(this.language['profile_haveChildren_' + userData.detail.lifestyle.have_children]) != 'undefined') {
                    value = this.language['profile_haveChildren_' + userData.detail.lifestyle.have_children];
                }
                value = value + ', ';
            }
            return value;
        },

        userProfilePartMixin_wantChildren(userData) {
            let value = '';
            value = this.userProfilePartMixin_fliterValue(this.getSelectLable('ms_want_children', userData.detail.lifestyle.want_children));
            if (value) {
                if (typeof(this.language['profile_wantChildren_' + userData.detail.lifestyle.want_children]) != 'undefined') {
                    value = this.language['profile_wantChildren_' + userData.detail.lifestyle.want_children];
                }
                value = value + ', ';
            }
            return value;
        },

        userProfilePartMixin_havePets(userData) {
            let value = '';
            value = this.userProfilePartMixin_fliterValue(this.getSelectLable('ms_pets', userData.detail.lifestyle.have_pets));
            if (value) {
                if (typeof(this.language['profile_havePets_' + userData.detail.lifestyle.have_pets]) != 'undefined') {
                    value = this.language['profile_havePets_' + userData.detail.lifestyle.have_pets];
                }
                value = value + ', ';
            }
            return value;
        },

        userProfilePartMixin_motorcycle(userData) {
            let value = '',
                m_type = userData.detail.basics.m_type;
            if (parseInt(m_type) != 2048 && parseInt(m_type) != 16384 && parseInt(m_type) != 18432) {
                value = this.userProfilePartMixin_fliterValue(this.getMultipleSelectLable(Unit.getObjLocalStorage('ms_m_type'), m_type, ', '));
            }

            if (value) {
                let valueArr = value.split(', ');
                if (valueArr.length > 1) {
                    value = ' and ' + valueArr.pop();
                    value = valueArr.join(', ') + value;
                }
                value = 'Has ' + value + ', ';
            }
            return value;
        },

        userProfilePartMixin_ridingHabits(userData) {
            let value = '';
            if (parseInt(userData.detail.lifestyle.passenger_type) != 0) {
                value = this.userProfilePartMixin_fliterValue(this.getSelectLable('ms_passenger_type', userData.detail.lifestyle.passenger_type));
            }
            if (value) {
                if (typeof(this.language['profile_ridingHabits_' + userData.detail.lifestyle.passenger_type]) != 'undefined') {
                    value = this.language['profile_ridingHabits_' + userData.detail.lifestyle.passenger_type];
                }
                value = value + ', ';
            }
            return value;
        },
        //lifestyle  end



    }

}

export default userProfilePartMixin;
